<button type="button" data-controller="dropdown" data-target="actions-post-<%= budget.id %>" aria-label="<%= t("decidim.admin.actions.actions_label", resource: translated_attribute(budget.title)) %>">
  <%= icon "more-fill", class: "text-secondary" %>
</button>

<div class="inline-block relative">
  <ul id="actions-post-<%= budget.id %>" class="dropdown dropdown__action" aria-hidden="true">
    <% if view == :deleted %>
      <% if allowed_to? :restore, :budget, trashable_deleted_resource: budget %>
        <li class="dropdown__item">
          <%= link_to url_for(action: :restore, id: budget, controller: "budgets"), method: :patch, class: "dropdown__button" do %>
            <%= icon "refresh-line" %>
            <%= t("decidim.admin.actions.restore") %>
          <% end %>
        </li>
      <% end %>
    <% else %>
      <% if allowed_to? :update, :budget, budget: budget %>
        <li class="dropdown__item">
          <%= link_to edit_budget_path(budget), class: "dropdown__button" do %>
            <%= icon "pencil-line" %>
            <%= t("actions.edit", scope: "decidim.budgets") %>
          <% end %>
        </li>
      <% else %>
        <li class="dropdown__item">
          <span class="dropdown__button" role="img" aria-label="<%= t("actions.edit", scope: "decidim.budgets") %>">
            <%= icon "pencil-line" %>
            <%= t("actions.edit", scope: "decidim.budgets") %>
          </span>
        </li>
      <% end %>

      <hr>

      <li class="dropdown__item">
        <%= link_to budget_projects_path(budget), class: "dropdown__button" do %>
          <%= icon "list-check" %>
          <%= t("actions.edit_projects", scope: "decidim.budgets") %>
        <% end %>
      </li>

      <hr>

      <li class="dropdown__item">
        <%= link_to resource_locator(budget).path, target: :blank, data: { "external-link": false }, class: "dropdown__button" do %>
          <%= icon "eye-line" %>
          <%= t("actions.preview", scope: "decidim.budgets") %>
        <% end %>
      </li>

      <hr>

      <li class="dropdown__item">
        <% if allowed_to? :soft_delete, :budget, trashable_deleted_resource: budget %>
          <%= link_to soft_delete_budget_path(budget), method: :patch, data: { confirm: t("actions.confirm_delete_budget", scope: "decidim.budgets") }, class: "dropdown__button" do %>
            <%= icon "delete-bin-line" %>
            <%= t("actions.soft_delete", scope: "decidim.admin") %>
          <% end %>
        <% else %>
          <span class="dropdown__button" role="img" aria-label="<%= t("actions.soft_delete", scope: "decidim.admin") %>">
            <%= icon "delete-bin-line" %>
            <%= t("actions.soft_delete", scope: "decidim.admin") %>
          </span>
        <% end %>
      </li>
    <% end %>
  </ul>
</div>
